package cn.xk.ymcc.fallback;

import cn.xk.ymcc.SearchFeignClient;
import cn.xk.ymcc.domain.dto.EsDto;
import cn.xk.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchFeignClientFallBack implements FallbackFactory<SearchFeignClient> {
    @Override
    public SearchFeignClient create(Throwable throwable) {
        return new SearchFeignClient() {//匿名内部类
            @Override
            public JSONResult save(EsDto esDto) {//返回托底数据
                return JSONResult.error("搜索服务异常");
            }
        };
    }
}
